package models

import (
    {{- $bb := false -}}
    {{- range .Columns -}}
    {{- $z := .IsQuery -}}
    {{- if ($z) -}}
    {{- if eq .GoType "time.Time" -}}{{- $bb = true -}}{{- end -}}
    {{- end -}}
    {{- end -}}
    {{- range .Columns -}}
    {{- if eq .GoField "CreatedAt" -}}
    {{- else if eq .GoField "UpdatedAt" -}}
    {{- else if eq .GoField "DeletedAt" -}}
    {{- else -}}
    {{- if eq .GoType "time.Time" -}}{{- $bb = true -}}{{- end -}}
    {{- end -}}
    {{- end -}}
    {{- if eq $bb true }}
    "time"
    {{- end }}

	"go-caipu/pkg/services/dto"

)

type {{.ClassName}} struct {
    {{ range .Columns -}}
    {{$x := .IsPk}}
    {{- if ($x) }}
    {{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"primaryKey;autoIncrement;comment:主键编码"`
    {{- else if eq .GoField "CreatedAt" -}}
    {{- else if eq .GoField "UpdatedAt" -}}
    {{- else if eq .GoField "DeletedAt" -}}
    {{- else if eq .GoField "CreateBy" -}}
    {{- else if eq .GoField "UpdateBy" -}}
    {{- else }}
    {{.GoField}} {{.GoType}} `json:"{{.JsonField}}" gorm:"type:{{.ColumnType}};comment:{{- if eq .ColumnComment "" -}}{{.GoField}}{{- else -}}{{.ColumnComment}}{{end -}}"` {{end -}}
    {{- end }}
    dto.ControlBy
    dto.ModelTime
}

func ({{.ClassName}}) TableName() string {
    return "{{.TBName}}"
}
